# myrand.py
import time

class _Random8:
    def __init__(self):
        self.seed = int(time.time()) & 0xFF

    def set_seed(self, v):
        self.seed = v & 0xFF

    def rand(self):
        self.seed = (self.seed * 3 + 7) & 0xFF
        return self.seed

# 预绑定
_inst = _Random8()
set_seed = _inst.set_seed    # 模块级函数
rand     = _inst.rand